package cn.bvin.lib.app;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
import cn.bvin.lib.basic_support.R;
import cn.bvin.lib.module.utils.SystemUtils.ResourceFinder;
/**
 * 
 * @ClassName: RequestHolderFragment 
 * @Description: 继承AbstractRPFragment，只需要继承实现initViews()方法和onCreateView，
 * 只需要在子类加载布局和绑定控件
 * @author: Bvin
 * @date: 2015年2月2日 上午10:53:53
 */
public class RequestHolderFragment extends AbsRequestHolderFragment{

	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.univ_request_place_holder,  container, false);
		initViews(rootView);
		return rootView;
	}

	@Override
	public void initViews(View rootView) {
		mLoadingFrame = rootView.findViewById(R.id.loading_frame);
		mEmptyFrame = rootView.findViewById(R.id.empty_frame);
		mErrorFrame = rootView.findViewById(R.id.error_frame);
		//错误视图是可以去点击重新请求的
		mErrorFrame.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				getRequestActivity().reloadRequest();
			}
		});
		tvLoadTip = (TextView) mLoadingFrame.findViewById(R.id.tvLoadTip);
		tvEmptyTips = (TextView) mEmptyFrame.findViewById(R.id.tvEmptyTips);
		tvErrorSceneTips = (TextView) mErrorFrame.findViewById(R.id.tvErrorSceneTips);
		defaultLoadTips = ResourceFinder.findString(getActivity(), R.string.loading_tips);
		defaultEmptyTips = ResourceFinder.findString(getActivity(), R.string.empty_tips);
		defaultSceneError = ResourceFinder.findString(getActivity(), R.string.error_scene_tips);
		defaultErrorSolution = ResourceFinder.findString(getActivity(), R.string.error_solution_click_retry);
	}
	
}
